package cn.tedu.hotel_management_system.controller;

import cn.tedu.hotel_management_system.base.json_result.ResultDataDto;
import cn.tedu.hotel_management_system.base.json_result.ResultDto;
import cn.tedu.hotel_management_system.pojo.dto.RoomMangerListDto;
import cn.tedu.hotel_management_system.pojo.dto.RoomUpdateStatusIn;
import cn.tedu.hotel_management_system.pojo.entity.Rooms;
import cn.tedu.hotel_management_system.service.RoomManagementService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.web.bind.annotation.*;

import java.util.logging.Logger;


/**
 * @author dkk
 * @date 2022/8/31
 * @desc 客房管理控制器
 */
@Slf4j
@RestController
@RequestMapping("room")
public class RoomManagementController {

    @Autowired
    private RoomManagementService roomManagementService;

    /**
     * 查询客房信息列表
     * @param page 当前页数
     * @param size 当前页数大小
     * @param roomMangerListDto 入参对象
     * @return json
     */
    @GetMapping("list/{page}/{size}")
    public ResultDataDto<Rooms> list(
            @PathVariable("page") Integer page , @PathVariable("size") Integer size,
            @RequestBody RoomMangerListDto roomMangerListDto
    ){
        return roomManagementService.list(page,size,roomMangerListDto);
    }

    /**
     * 更新房间状态信息
     * @param roomUpdateStatusIn 房间编号,更新状态
     * @return 是否更新成功
     */
    @GetMapping("updateStatus")
    public ResultDto<Void> updateStatus(@RequestBody  RoomUpdateStatusIn roomUpdateStatusIn){
        return roomManagementService.updateStatus(roomUpdateStatusIn);
    }

}
